<?
		
	header("Content-Type: text/html; charset=ISO-8859-1",true); 

	if(!isset($_SESSION['login_efetuado'])){
		header("Location: http://www.celuladigital.com.br/site/erros/");
	}

	$id_erros = isset($_REQUEST["id_erros"]) ? $_REQUEST["id_erros"] : 0;
	
	$sql = " SELECT * FROM celula_erros WHERE id_erros = ".$id_erros;
	$conexao->executa($sql);
	$conexao->dados();
		
	if(( $id_erros == 0 ) || ( $conexao->qtd == 0 )){
		echo "<script language= 'JavaScript'> alert('Nenhum ticket com o código ".$id_erros." foi encontrado!'); location.href='index.php'; </script>";
	}	
	
?>

<form enctype="multipart/form-data" action="index.php" method="post">
<div align="center"><h3 style="color:#FFFFFF">Cadastrado por:
<?
 if($_SESSION['tipo_login'] == 'funcionario'){
?>
	<input type="text" name="email" id="email" value="<?= strtoupper($conexao->data["email"]) ?>" />
<?
} 
	if($_SESSION['tipo_login'] == 'cliente'){ echo strtoupper($conexao->data["email"]); }
?>
</h3>  
  <h3 style="color:#FFFFFF">Status: 
  <?
 if($_SESSION['tipo_login'] == 'funcionario'){
?>
  <select name="status" id="status">
    <? 
  	if($conexao->data["status"] == 'NOVO')
  		echo "<option value='NOVO' selected='selected'>NOVO</option>";
	else
		echo "<option value='NOVO'>NOVO</option>";
		
  	if($conexao->data["status"] == 'RESOLVENDO')
  		echo "<option value='RESOLVENDO' selected='selected'>RESOLVENDO</option>";
	else
		echo "<option value='RESOLVENDO'>RESOLVENDO</option>";
		
  	if($conexao->data["status"] == 'PENDENTE')
  		echo "<option value='PENDENTE' selected='selected'>PENDENTE</option>";
	else
		echo "<option value='PENDENTE'>PENDENTE</option>";
		
  	if($conexao->data["status"] == 'RESOLVIDO')
  		echo "<option value='RESOLVIDO' selected='selected'>RESOLVIDO</option>";
	else
		echo "<option value='RESOLVIDO'>RESOLVIDO</option>";
  ?>
  </select>
  <? } 
  	
	 if($_SESSION['tipo_login'] == 'cliente'){
		echo strtoupper($conexao->data["status"]);
   	} 
?>
   </h3>
<h3 style="color:#FFFFFF">
  <strong>Sistema:</strong> 
  <?
 if($_SESSION['tipo_login'] == 'funcionario'){
?>
  <select name="sistema" id="sistema">
    <? 
  	if($conexao->data["sistema"] == 'Imobiliaria')
  		echo "<option value='Imobiliaria' selected='selected'>Imobiliaria</option>";
	else
		echo "<option value='Imobiliaria'>Imobiliaria</option>";
		
  	if($conexao->data["sistema"] == 'Restaurante')
  		echo "<option value='Restaurante' selected='selected'>Restaurante</option>";
	else
		echo "<option value='Restaurante'>Restaurante</option>";
		
  	if($conexao->data["sistema"] == 'Website')
  		echo "<option value='Website' selected='selected'>Website</option>";
	else
		echo "<option value='Website'>Website</option>";
		
  	if($conexao->data["sistema"] == 'Outros')
  		echo "<option value='Outros' selected='selected'>Outros</option>";
	else
		echo "<option value='Outros'>Outros</option>";
  ?>
  </select>
  <? } if($_SESSION['tipo_login'] == 'cliente'){ echo strtoupper($conexao->data["sistema"]); } ?>
  </h3>
 <h3 style="color:#FFFFFF"><img src="imagem/file_important.png" width="32" height="32" />Resposta:</h3><h2 style="color:#FFFF00">
 <? if($_SESSION['tipo_login'] == 'cliente'){ echo $conexao->data["resposta"]; } if($_SESSION['tipo_login'] == 'funcionario'){ ?>
 <textarea name="resposta" id="resposta" cols="100" rows="10"><?= $conexao->data["resposta"] ?>&nbsp;</textarea>
  <? } ?>
  </h2>
 <h3 style="color:#FFFFFF"><img src="imagem/core.png" width="32" height="32" />Relato:</h3> 
<span style="font-size:20px;"><b><font size=3 color=white><?= $conexao->data["problema"] ?></font></b></span>
<br />
<br />
<h3 style="color:#FFFFFF">Coment&#225;rio e/ou Relato</h3>
<textarea name="problema" id="problema" cols="100" rows="10"><? if($_SESSION['tipo_login'] == 'funcionario'){ echo htmlentities($conexao->data["problema"]); }?>
</textarea>
<br />
<br />
<? if(strlen($conexao->data["anexo"]) > 0){ ?>
<strong>Anexo:</strong> <a href="http://www.celuladigital.com.br/site/erros/anexos/<?=  $conexao->data["anexo"] ?>" target="_blank"><?=  $conexao->data["anexo"] ?> </a><br /><? } else { echo "<strong>Anexo:</strong> <input name='anexo' type='file' size='80'/><br />"; } ?>
<br />
<strong>Data de Cria&#231;&#227;o</strong> 
<font style="color:#FFFFFF"><?=  $conexao->data["data_criacao"] ?></font><br />
<strong>Data de Altera&#231;&#227;o:</strong> 
<font style="color:#FFFFFF"><?=  $conexao->data["data_alteracao"] ?></font><br>
<strong>Data de Solu&#231;&#227;o:</strong>
<font style="color:#FFFFFF"><?=  $conexao->data["data_solucao"] ?></font>
<br>
<br />
  <br />
  <br />
  <input type="image" name="OK" id="OK" src="imagem/forward.png" value="Enviar Informações">
  <br />
  <br />
  <br />
  <input type="hidden" name="id_erros" id="id_erros" value="<?=  $conexao->data["id_erros"] ?>">
  <? if($acao == 'visualizar'){ ?>
  <input type="hidden" name="acao" id="acao" value="atualizar">
  <? } ?>
  <? if($acao == 'cadastrar'){ ?>
  <input type="hidden" name="acao" id="acao" value="cadastrar">
  <? } ?>
  <? if($acao == 'editar'){ ?>
  <input type="hidden" name="acao" id="acao" value="edicao">
  <? } ?>
  
  <input type="hidden" name="anexo" id="anexo" value="<?=  $conexao->data["anexo"] ?>">
</div>
</form>
